﻿using FieldTools.Client.Model.Base;
using FieldTools.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FieldTools.Client.Model.Page
{
    [Save]
    public class SettingModel : BaseModel
    {
        public SettingModel() : base(System.Reflection.MethodBase.GetCurrentMethod()?.DeclaringType.Name)
        {
            //IsAutoStartHttpService = false;
        }
        public SettingModel(string className) : base(className)
        {

        }
        private bool isAutoStartHttpService = false;
        /// <summary>
        /// 是否自动启动http服务
        /// </summary>
        public bool IsAutoStartHttpService
        {
            get { return isAutoStartHttpService; }
            set {
                //var old = isAutoStartHttpService;
                isAutoStartHttpService = value;
                //if (old != value) SavaConfig(this, nameof(IsAutoStartHttpService));
                SavaConfigAndRaisePropertyChanged(this, nameof(IsAutoStartHttpService),  value);
            }
        }

        private bool isAutoStartTcpService;
        /// <summary>
        /// 是否自动启动TCP服务
        /// </summary>
        public bool IsAutoStartTcpService
        {
            get { return isAutoStartTcpService; }
            set {
                isAutoStartTcpService = value;
                SavaConfigAndRaisePropertyChanged(this, nameof(IsAutoStartTcpService),  value);
            }
        }

        private bool isAutoStartUdpService;
        /// <summary>
        /// 是否自动启动UDP服务
        /// </summary>
        public bool IsAutoStartUdpService 
        {
            get { return isAutoStartUdpService; }
            set
            {
                isAutoStartUdpService = value;
                SavaConfigAndRaisePropertyChanged(this, nameof(IsAutoStartUdpService), value);
            }
        }
    }
}
